#include "EditorPanelModel.h"

#include "Object/NewObject.h"
#include "Ability/DebugConsole/EditorDebugConsoleModel.h"
#include "Ability/Output/EditorOutputAbilityModel.h"

void REditorPanelModel::FirstTimeInitializeObject()
{
    //初始化能力
    Super::FirstTimeInitializeObject();

    auto DebugConsole = NewObject<REditorDebugConsoleModel>(this);
    PanelAbilitys.Add(DebugConsole);

    auto Output = NewObject<REditorOutputAbilityModel>(this);
    PanelAbilitys.Add(Output);
    ActivedAbilityIndex=1;
}


int64_t REditorPanelModel::GetPanelAbilitysNum() const
{
    return PanelAbilitys.Num();
}

TSharedObjectPtr<REditorAbilityModel> REditorPanelModel::GetPanelAbility(int64_t Index) const
{
    return PanelAbilitys[Index];
}

void REditorPanelModel::InsertPanelAbility(int64_t Index, TSharedObjectPtr<REditorAbilityModel> InAbility)
{
    PanelAbilitys.Insert(Index, InAbility);
    OnPanelAbilityAdded.ExecuteIfBound(Index, InAbility);
}

void REditorPanelModel::RemovePanelAbility(int64_t Index)
{
    PanelAbilitys.RemoveAt(Index);
    OnPanelAbilityRemoved.ExecuteIfBound(Index);
}

